/* Copyright 2006, 2007 Christophe Jeannin

    This file is part of xch.

    xch is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    xch is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with xch; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

/************  controls  ************/
#define IDD_STARTUP		1000
#define IDC_GRP1		1001
#define IDC_RBN1		1002
#define IDC_RBN2		1003
#define IDC_IPA1		1004
#define IDC_BTN1		1005

#define IDD_LISTEN		1010
#define IDC_STC1		1011
#define IDC_PGBLISTEN	1012
#define ID_CANCEL		1013

#define IDD_MAIN		1020
#define IDC_EDIT		1021
#define IDC_SEND		1022
#define IDC_TOP			1023
/************************************/



/********** custom messages *********/
#define XCH_CONNECTED	WM_USER+106
#define XCH_TERMINATE	WM_USER+107
#define XCH_INCOMING	WM_USER+108
#define XCH_TERMSIG		WM_USER+109
/************************************/



#define XCH_SERVERADDR	0xC0A80002		// 192.168.0.2
#define XCH_PORT		htons(12006)

#define XCH_LISTEN		1
#define XCH_CONNECT		2

#define XCH_TEST		htonl(0x74657374)	// the 4 characters "test"
#define XCH_OK			htons(0x4F4B)		// the 2 characters "OK"
#define XCH_QUIT		htonl(0x0601F1F6)	// random check code

#define	XCH_TIMER		100

#define XCH_CLOSEDELAY	700


#include <windows.h>
#include <winsock.h>
#include <commctrl.h>
#include <tchar.h>


// Prototypes
INT_PTR CALLBACK StartupDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK ListenDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
BOOL ConnectProc();
DWORD WINAPI MainThread(LPVOID hDlg);
DWORD WINAPI ListenThread(LPVOID hDlg);
